import { useState } from "react"

const App = () => {
  const [counter,setCounter] = useState(0)

  return (
    <div>
      <div>{counter}</div>
      <button onClick = {() => {
        setCounter(counter + 1)
        console.log('clicked for add')
      }}> add </button>

      
        <button onClick={()=>{
          setCounter(counter - 1)
          console.log('clicked for sub')
        }}
        > sub </button>
      
      <div>
        <button onClick={()=>setCounter(0)}>reset</button>
      </div>
    </div>
  )

}

export default App